![]() |
ALMaSS
1.0
The Animal, Landscape and Man Simulation System
|
The newt adult class - contains behaviour and attributes common to adults but not juveniles. More...
#include <Newt.h>
Public Member Functions | |
Newt_Adult (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib) | |
Newt_Adult constructor. More... | |
~Newt_Adult () | |
Newt_Male destructor. More... | |
virtual void | Init (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age) |
Initialise object. More... | |
virtual void | ReInit (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib) |
Used to re-use an object - must be implemented in descendent classes. More... | |
int | GetInPond () |
Returns the current pond status (-1 if not in pond else the pond ref is returned) More... | |
void | SetInPond () |
Forces setting the in pond status to the first pond ref - used only on start-up. More... | |
![]() | |
Newt_Juvenile (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib) | |
Newt_Juvenile constructor. More... | |
~Newt_Juvenile () | |
Newt_Juvenile destructor. More... | |
virtual void | Step (void) |
Newt_Juvenile Step code. This is called continuously until all animals report that they are 'DONE'. More... | |
double | GetWeight () |
Get method for m_weight. More... | |
void | SetWeight (double a_weight) |
Set method for m_weight. More... | |
void | InternalPesticideHandlingAndResponse () |
For handlng of class-specific pesticide effects. More... | |
![]() | |
Newt_Base (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, bool a_reproinhib) | |
Newt constructor. More... | |
void | Init (vector< unsigned > a_pond, Newt_Population_Manager *a_NPM, bool a_reproinhib) |
Intitialise object. More... | |
void | ReInit (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, bool a_reproinhib) |
ReInit for object pool. More... | |
~Newt_Base () | |
Newt destructor. More... | |
virtual int | WhatState () |
Returns the state number for display purposes. More... | |
TTypeOfNewtState | st_Develop (void) |
Behavioural state development - does nothing in the base class. More... | |
TTypeOfNewtState | st_Movement (void) |
Behavioural state movement - does nothing in the base class. More... | |
void | st_Dying (void) |
Behavioural state dying. More... | |
virtual void | BeginStep (void) |
The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep. More... | |
virtual void | EndStep (void) |
The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep. More... | |
unsigned | GetAge () |
A typical interface function - this one returns the Age as an unsigned integer. More... | |
void | SetAge (unsigned a_age) |
A typical interface function - this one sets the Age as an unsigned integer. More... | |
unsigned | GetHomePond () |
A typical interface function - this one returns the home pond reference as an unsigned integer. More... | |
void | SetHomePond (unsigned a_pond) |
A typical interface function - this one sets the home pond reference as an unsigned integer. More... | |
void | InternalPesticideHandlingAndResponse (double) |
For handlng of class-specific pesticide effects. More... | |
![]() | |
unsigned | SupplyFarmOwnerRef () |
AnimalPosition | SupplyPosition () |
APoint | SupplyPoint () |
int | SupplyPolygonRef () |
int | Supply_m_Location_x () |
int | Supply_m_Location_y () |
virtual void | KillThis () |
virtual void | CopyMyself () |
void | SetX (int a_x) |
void | SetY (int a_y) |
TAnimal (int x, int y, Landscape *L) | |
virtual void | ReinitialiseObject (int x, int y, Landscape *L) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual void | Dying () |
void | CheckManagement (void) |
void | CheckManagementXY (int x, int y) |
virtual bool | OnFarmEvent (FarmToDo) |
![]() | |
int | GetCurrentStateNo () |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
virtual void | ReinitialiseObject () |
Used to re-use an object - must be implemented in descendent classes. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject () |
The destructor for TALMaSSObject. More... | |
void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
Static Public Attributes | |
static double | m_AdultPPPThreshold = cfg_NewtAdultPPPToxTrigger.value() |
The threshold for effect of PPP on adults. More... | |
static double | m_AdultPPPElimRate = cfg_NewtAdultPPPToxEliminationRate.value() |
The daily proportion of PPP body burden that is not eliminated for adults. More... | |
static double | m_AdultPPPEffectProbability = cfg_NewtAdultPPPEffectProbability.value() |
The daily probability of effect if above m_AdultPPPThreshold for adults. More... | |
static unsigned | m_AdultLifespan = cfg_NewtAdultLifespan.value() |
static int | m_newtadultwalkspeed = cfg_NewtWalkSpeed.value()/10 |
The max walking speed of a newt. More... | |
![]() | |
static double | m_JuvenilePPPThreshold_Min = 0 |
The minimum threshold for effect of PPP on juveniles. More... | |
static double | m_JuvenilePPPThreshold_EnvConc = cfg_NewtJuvenilePPPToxTrigger_EnvConc.value() |
The environmental concentration threshold for effect of PPP on juveniles. More... | |
static double | m_JuvenilePPPThreshold_Overspray = cfg_NewtJuvenilePPPToxTrigger_Overspray.value() |
The overspray threshold for effect of PPP on juveniles. More... | |
static double | m_JuvenilePPPElimRate = cfg_NewtJuvenilePPPToxEliminationRate.value() |
The daily proportion of PPP body burden that is not eliminated for juveniles. More... | |
static double | m_JuvenilePPPEffectProbability_EnvConc = cfg_NewtJuvenilePPPEffectProbability_EnvConc.value() |
The daily probability of effect if above m_JuvenilePPPThreshold for juveniles for environmental concentration. More... | |
static double | m_JuvenilePPPEffectProbability_Overspray = cfg_NewtJuvenilePPPEffectProbability_Overspray.value() |
The daily probability of effect if above m_JuvenilePPPThreshold for juveniles for overspray. More... | |
static double | m_JuvenileDailyWeightGain = cfg_NewtJuvenileDailyLengthGain.value() |
Used in determining daily growth. More... | |
static int | m_SimW = 0 |
The width of the simulation map, stored for fast access. More... | |
static int | m_SimH = 0 |
The height of the simulation map, stored for fast access. More... | |
static double | m_roadmortalityprob = cfg_NewtRoadMortalityProb.value() |
The probability of death when crossing a road. More... | |
static int | m_newtwalkspeed = cfg_NewtWalkSpeed.value() |
The max walking speed of a newt. More... | |
static int | m_newtwalkstepsize = cfg_NewtWalkStepsize.value() |
The size of a step when evaluating habitat during walking. More... | |
static double | m_goodhabitatdispersalprob = cfg_newtgoodhabitatdispersalprob.value() |
Probability of dispersal in good habitat. More... | |
static double | m_poorhabitatdispersalprob = cfg_newtpoorhabitatdispersalprob.value() |
Probability of dispersal in poor habitat. More... | |
static double | m_NewtDormancyTemperature = cfg_newtdormancytemp.value() |
Temperature in degrees that the newts become dormant. More... | |
static double | m_NewtDormancyHumidity = cfg_newtdormancyhumidity.value() |
Temperature in degrees that the newts become dormant. More... | |
![]() | |
static double | m_EggDevelopmentDDTotal = cfg_NewtEggDevelTotal.value() |
static double | m_EggDevelopmentDDParameter = cfg_NewtEggDevelDDParameter.value() |
static double | m_JuvenileDevelopmentSize = cfg_NewtJuvenileDevelSize.value() |
static double | m_EggMortalityChance = cfg_NewtEggMortalityChance.value() |
static double | m_JuvenileMortalityChance = 0.0 |
static double | m_AdultMortalityChance = 0.0 |
static bool | m_test_pesticide_egg = cfg_Newt_Test_Pesticide_Egg.value() |
Flags to record whether we are in pesticide testing mode. More... | |
static bool | m_test_pesticide_larva = cfg_Newt_Test_Pesticide_Larva.value() |
static bool | m_test_pesticide_terrestrial = cfg_Newt_Test_Pesticide_Terrestrial.value() |
Protected Member Functions | |
void | CalcMovementVector (void) |
Calculates the direction needed to move in to get to the target pond. More... | |
bool | AgeMortTest (void) |
Ages the adult and applies a daily mortality probability. More... | |
virtual TTypeOfNewtState | st_Develop (void) |
Adult development state. More... | |
virtual TTypeOfNewtState | st_Disperse (void) |
Adult development state. More... | |
virtual TTypeOfNewtState | st_Overwinter (void) |
Adult dormant state. More... | |
virtual TTypeOfNewtState | st_Migrate (void) |
Adult migration to pond state. More... | |
virtual TTypeOfNewtState | st_EvaluateHabitat (void) |
Adult evaluate habitat behaviour. More... | |
![]() | |
virtual TTypeOfNewtState | st_NextStage (void) |
Juvenile maturation. More... | |
void | MoveTo (TTypeDirectedWalk a_directedness, int a_stepsize, int a_steps) |
Top level control of newt movement. More... | |
void | NewtDoWalking (int &a_vector, int a_stepsize, int a_steps, int &vx, int &vy) |
This method moves the newt through the landscape. More... | |
void | NewtDoWalkingCorrect (int &a_vector, int a_stepsize, int a_steps, int &vx, int &vy) |
This method moves the newt through the landscape using wrap around corrects. More... | |
int | NewtMoveQuality (int a_x, int a_y, TTypesOfLandscapeElement &a_tole) |
Tests the habitat quality for a square to move to. More... | |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Protected Attributes | |
int | m_targetpondx |
x-coord of a target pond More... | |
int | m_targetpondy |
y-coord of a target pond More... | |
![]() | |
int | m_InPond |
The polyrefindex for the pond the newt is in, or -1 if not in a pond. More... | |
double | m_weight |
unsigned | m_OurVector |
The last direction we moved in. More... | |
TTypesOfLandscapeElement | m_CurrentHabitat |
The current habitat type the newt is in. More... | |
bool | m_forcedisperse |
A flag to force dispersal from the breeding ponds. More... | |
![]() | |
TTypeOfNewtState | m_CurrentNewtState |
Variable to record current behavioural state. More... | |
unsigned | m_Age |
vector< unsigned > | m_pondlist |
Newt_Population_Manager * | m_OurPopulationManager |
This is a time saving pointer to the correct population manager object. More... | |
double | m_body_burden |
The current PPP body burden for use in pesticide testing mode. More... | |
bool | m_reproductiveinhibition |
A flag to indicate environmentally induced reproductive inhibition (value is inherited by descendent classes) More... | |
![]() | |
int | m_Location_x |
int | m_Location_y |
Landscape * | m_OurLandscape |
![]() | |
int | m_CurrentStateNo |
The basic state number for all objects - '-1' indicates death. More... | |
bool | m_StepDone |
Indicates whether the iterative step code is done for this timestep. More... | |
The newt adult class - contains behaviour and attributes common to adults but not juveniles.
Newt_Adult::Newt_Adult | ( | int | a_x, |
int | a_y, | ||
vector< unsigned > | a_pond, | ||
Landscape * | a_L, | ||
Newt_Population_Manager * | a_NPM, | ||
unsigned | a_age, | ||
bool | a_reproinhib | ||
) |
Newt_Adult constructor.
References Init().
Newt_Adult::~Newt_Adult | ( | void | ) |
Newt_Male destructor.
|
protected |
Ages the adult and applies a daily mortality probability.
Ages the adult and tests for daily mortality using the supplied parameter for daily adult mortality stored in m_AdultMortalityChance. This function is used by st_Develop, st_Overwinter and Newt_Female::st_Breed behaviours.
References g_rand_uni, m_AdultLifespan, Newt_Base::m_AdultMortalityChance, and Newt_Base::m_Age.
Referenced by Newt_Female::st_Breed(), st_Develop(), and st_Overwinter().
|
inlineprotected |
Calculates the direction needed to move in to get to the target pond.
This is a very simple direction calculator. It will fail if the pond is over a wrap around boundary. To simplify this we only assume diagonal movement.
References direction_ne, direction_nw, direction_se, direction_sw, TAnimal::m_Location_x, TAnimal::m_Location_y, Newt_Juvenile::m_OurVector, m_targetpondx, and m_targetpondy.
Referenced by st_Migrate().
|
inline |
Returns the current pond status (-1 if not in pond else the pond ref is returned)
References Newt_Juvenile::m_InPond.
|
virtual |
Initialise object.
Newt_Adult Initialise object, assigns default values to specific adult attributes for in pond and target pond for migration, and passes the age to the Newt_Juvenile constructor.
References Newt_Juvenile::m_InPond, m_targetpondx, m_targetpondy, Newt_Population_Manager::RecordAdultProduction(), Landscape::SupplyElementTypeFromVector(), Landscape::SupplyPolyRefIndex(), and tole_Pond.
Referenced by Newt_Adult(), and ReInit().
|
virtual |
Used to re-use an object - must be implemented in descendent classes.
Reimplemented from Newt_Juvenile.
Reimplemented in Newt_Female, and Newt_Male.
References Init(), and Newt_Juvenile::ReInit().
Referenced by Newt_Male::ReInit(), and Newt_Female::ReInit().
|
inline |
Forces setting the in pond status to the first pond ref - used only on start-up.
References Newt_Juvenile::m_InPond, and Newt_Base::m_pondlist.
|
protectedvirtual |
Adult development state.
First determines whether the newt sucumbs to daily mortality, if so return toNewts_Die state.
If the adult survives:
Reimplemented from Newt_Juvenile.
Reimplemented in Newt_Female, and Newt_Male.
References AgeMortTest(), Calendar::Date(), g_date, Newt_Juvenile::m_NewtDormancyTemperature, TAnimal::m_OurLandscape, Landscape::SupplyTempPeriod(), toNewts_Die, toNewts_EvaluateLocation, and toNewts_Overwinter.
Referenced by Newt_Male::st_Develop(), and Newt_Female::st_Develop().
|
protectedvirtual |
Adult development state.
The newt can only move around when the humidity is high. Here we assume this is related to the rainfall and temperature of the preceeding days. If the humidity is high enough then the newt moves otherwise it stays where it is and returns toNewts_Develop.
The newt moves around using a random walk. At each step it evaluates if the habitat is walks onto is legal (if not it does not move), and if a pond it remembers this. The new pond is added to the m_pondlist vector.
The rate of the random walk is set by a input parameter stored in the static attribute m_newtwalkspeed. During the dispersal roads have associated mortality risks. These are flagged and probability tests taken.
If killed in dispersal, the current state will be changed to die by MoveTo->NewtDoWalking, so if this has been altered from toNewts_Dispersal then return the new state, otherwise returns toNewts_Develop. Note that adult dispersal in identical to juvenile dispersal, but differs in the distance assumed to be moved - which is reduced to 10% of the juvenile.
Reimplemented from Newt_Juvenile.
References Calendar::Date(), directedwalk_high, directedwalk_random, g_date, Newt_Base::m_CurrentNewtState, Newt_Juvenile::m_forcedisperse, m_newtadultwalkspeed, Newt_Juvenile::m_NewtDormancyHumidity, Newt_Juvenile::m_NewtDormancyTemperature, Newt_Juvenile::m_newtwalkstepsize, TAnimal::m_OurLandscape, Newt_Juvenile::MoveTo(), Landscape::SupplyHumidity(), Landscape::SupplyTempPeriod(), toNewts_Develop, and toNewts_Die.
Referenced by Newt_Male::Step(), and Newt_Female::Step().
|
protectedvirtual |
Adult evaluate habitat behaviour.
The first thing to determine is whether this is the breeding season or not. This is controlled by the population manager. If it is breeding then:
If in a pond and after the NEWT_BREEDINGSEAONEND but before NEWT_BREEDINGSEAONEND+30 then it will disperse based on a probability which reaches unity by NEWT_BREEDINGSEAONEND+30. If its not the breeding season and not in pond then evaluate habitat and determine the dispersal necessity. This is identical to the juvenile st_EvaluateHabitat, which is what is called.
Reimplemented from Newt_Juvenile.
Reimplemented in Newt_Female, and Newt_Male.
References g_rand_uni, Newt_Population_Manager::IsBreedingSeason(), Newt_Juvenile::m_forcedisperse, Newt_Juvenile::m_InPond, Newt_Base::m_OurPopulationManager, Newt_Juvenile::st_EvaluateHabitat(), toNewts_Breed, toNewts_Develop, and toNewts_Migrate.
Referenced by Newt_Male::st_EvaluateHabitat().
|
protectedvirtual |
Adult migration to pond state.
The newt needs to return to its home pond or another on its list of ponds found if any. This requires a directed migration. Along the way the newt tests each step to see if it is a possible breeding location, or road mortality possibility.
First it tests to see if m_targetpondx is set, if its equal to -1 we have not target and need to aquire this. This is done by comparing the pondlist distances and picking the closest one.
Next the direction to the pond is needed. This is stored in m_OurVector, but may need updating.
The newt now needs to move towards the target pond. This is done using the standard newt movement code, but the stopping rule is that we get to a breeding pond, or that breeding season is over.
Calculates distance from location a_x, a_y. This is done using an approximation to pythagorus to avoid a speed problem.
NB this will crash if either a_dy or a_dx are zero, therefore the addition of 1!
References CalcMovementVector(), directedwalk_totally, g_rand_uni, Newt_Juvenile::m_CurrentHabitat, Newt_Base::m_CurrentNewtState, Newt_Juvenile::m_InPond, TAnimal::m_Location_x, TAnimal::m_Location_y, Newt_Juvenile::m_newtwalkspeed, Newt_Juvenile::m_newtwalkstepsize, TAnimal::m_OurLandscape, Newt_Juvenile::m_OurVector, Newt_Base::m_pondlist, Newt_Juvenile::m_SimH, Newt_Juvenile::m_SimW, m_targetpondx, m_targetpondy, APoint::m_x, APoint::m_y, Newt_Juvenile::MoveTo(), Landscape::SupplyCentroidIndex(), Landscape::SupplyPolyRefIndex(), tole_Pond, toNewts_Breed, toNewts_Develop, and toNewts_Die.
Referenced by Newt_Male::Step(), and Newt_Female::Step().
|
protectedvirtual |
Adult dormant state.
Reimplemented from Newt_Juvenile.
References AgeMortTest(), Calendar::Date(), g_date, Newt_Juvenile::m_NewtDormancyTemperature, TAnimal::m_OurLandscape, Landscape::SupplyTempPeriod(), toNewts_Develop, toNewts_Die, and toNewts_Overwinter.
Referenced by Newt_Male::Step(), and Newt_Female::Step().
|
static |
The lifespan of the adult
Referenced by AgeMortTest().
|
static |
The daily probability of effect if above m_AdultPPPThreshold for adults.
Referenced by Newt_Male::InternalPesticideHandlingAndResponse(), Newt_Female::InternalPesticideHandlingAndResponse(), and Newt_Population_Manager::Newt_Population_Manager().
|
static |
The daily proportion of PPP body burden that is not eliminated for adults.
Referenced by Newt_Population_Manager::Newt_Population_Manager(), Newt_Male::st_Develop(), and Newt_Female::st_Develop().
|
static |
The threshold for effect of PPP on adults.
Newt_Adult adds the following attributes:
Four behavioural states are defined for the adult:
Referenced by Newt_Male::InternalPesticideHandlingAndResponse(), Newt_Female::InternalPesticideHandlingAndResponse(), and Newt_Population_Manager::Newt_Population_Manager().
|
static |
The max walking speed of a newt.
Referenced by Newt_Population_Manager::Newt_Population_Manager(), and st_Disperse().
|
protected |
x-coord of a target pond
Referenced by CalcMovementVector(), Init(), and st_Migrate().
|
protected |
y-coord of a target pond
Referenced by CalcMovementVector(), Init(), and st_Migrate().